<admintpl file="header" />
<script type="text/javascript" src="public/js/My97DatePicker/WdatePicker.js?3"></script>

</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li ><a href="{:U('AdminCard/import')}">卡导入</a></li>
        <li class="active"><a href="{:U('AdminCard/import_history')}" target="_self">导入历史</a></li>
        <li ><a href="{:U('AdminCard/card_list')}">已导入列表</a></li>
    </ul>
    <form class="well form-search" method="post" action="{:U('AdminCard/import_history')}" onsubmit="return check_form();">
        请选择时间：
        <input type="text" name="s_start_time" id="s_start_time" onclick="start_time()" style="width: 200px;" value="{$s_start_time}"/>至
        <input type="text" name="s_end_time" id="s_end_time" onclick="end_time()" style="width: 200px;"  value="{$s_end_time}"/>
        <input type="hidden" id="h_start_time" value="{$s_start_time}">
        <input type="hidden" id="h_end_time" value="{$s_end_time}">
        &nbsp;&nbsp;
        <div <if condition="$s_show == 2">style="display:inline-block"<else/>style="display: none;"</if> class="s_number">
            ICCID:
            <input type="text" name="s_number" style="width: 200px;"  value="{$s_number}">
        </div>
        展现方式：
        <select name="s_show" id="s_show">
            <option value="1" <if condition="$s_show != 2">selected</if> >汇总</option>
            <option value="2" <if condition="$s_show == 2">selected</if> >详单</option>
        </select>
        <input type="submit" class="btn btn-primary" value="搜索" />
    </form>
    <form class="js-ajax-form" action="" method="post">

        <table class="table table-hover table-bordered table-list">
            <if condition="$s_show == 1">
                <thead>
                <tr>
                    <td>起始时间</td>
                    <td>激活结果</td>
                </tr>
                </thead>
                <tr>
                    <td>{$s_start_time} ~ {$s_end_time}</td>
                    <td>成功: {$success_num}条 , 失败: {$fail_num}条</td>
                </tr>
            <else/>
                <thead>
                <tr>
                    <td>卡号</td>
                    <td>iccid</td>
                    <td>导入时间</td>
                    <td>激活状态</td>
                </tr>
                </thead>
                <foreach name="card_import_list" item="vo">
                    <tr>
                        <td>{$vo.card_number}</td>
                        <td>{$vo.card_iccid}</td>
                        <td>{$vo.create_time}</td>
                        <td>{$vo.card_import_status}</td>
                    </tr>
                </foreach>
            </if>

        </table>
        <if condition="$s_show != 1">
            <div class="pagination">{$page}</div>
            <div style="float: right">
                <a  href="{:U('Download/current',array('type'=>'import_history'))}" class="btn btn-primary">下载当前</a>&nbsp;&nbsp;
                <a  href="{:U('Download/all',array('type'=>'import_history','s_start_time'=>$s_start_time,'s_end_time'=>$s_end_time,'s_number'=>$s_number))}" class="btn btn-primary" onclick="javascript:return confirm_download();">下载全部</a>
            </div>
        </if>
    </form>
</div>
<script>

    function start_time(){
        WdatePicker({maxDate:"{$a}",onpicking:function(dp){
            $("#h_start_time").val(dp.cal.getNewDateStr());
        }
    });
    }
    function end_time(){
        WdatePicker({minDate:"{$b}",onpicking:function(dp){
            $("#h_end_time").val(dp.cal.getNewDateStr());
        }
        });
    }

    function check_form(){
        var h_start_time = $("#h_start_time").val();
        var h_end_time = $("#h_end_time").val();
        console.log(h_start_time);
        var start_arr = h_start_time.split("-");
        var end_arr = h_end_time.split("-");
        if(start_arr[0] == end_arr[0] && start_arr[1] == end_arr[1]){
            return true;
        }else{
            alert("查询日期必须在同一个月!");return false;
        }
    }


    $(function(){
       $("#s_show").change(function(){
           var s_show = $(this).val();
           if(s_show == 2){
               $(".s_number").show();
               $(".s_number").css("display","inline-block");
           }else{
               $(".s_number").hide();
           }
       });
    });




</script>
<script src="__PUBLIC__/js/common.js?2"></script>


</body>
</html>